import Vue from 'vue';
import App from './App';
// 引入全局存储
import store from '@/store';
// 引入全局配置
import rfLoading from '@/components/rf-loading';



if (process.env.NODE_ENV === 'production') {
	Vue.config.productionTip = false;
}
Vue.component('rfLoading', rfLoading);

App.mpType = 'app';

Vue.mixin({
	computed: {
		themeColor: {
			get () {
				// return store.getters.themeColor;
			},
			set (val) {
				// store.state.themeColor = val;
			}
		}
	}
});
const username = localStorage.getItem('user');
const token=localStorage.getItem('token');
if(username&&token){
	store.state.username=username;
	store.state.isLogin=true;
}else{
	store.state.isLogin=false;
	// router.push('/pages/public/login')
	uni.navigateTo({
		url:'pages/public/login'
	})
}


// 保留小数点后两位
Vue.filter('keepTwoDecimal', value => {
  return (Math.floor((value || 0) * 100) / 100).toFixed(2);
});

const app = new Vue({
	...App,
	store: store
});
app.$mount();
